﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Interface;

namespace OpenAuth.App
{
    public class usp_bqmrmx_hfAPP: ApiBaseApp<usp_bqmrmx_hf>
    {
        HsLogApp hsApp = null;
        public usp_bqmrmx_hfAPP(IApiRepository<usp_bqmrmx_hf> repository, IRepository<usp_bqmrmx_hf> repo,HsLogApp _hsApp) : base(repository)
        {
            hsApp = _hsApp;
        }

        public IEnumerable<usp_bqmrmx_hf> QueryYRQ(string zyh, string time)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Blh", zyh));
            param.Add(new SqlParameter("@Tjrq",time));
            var result = Query<usp_bqmrmx_hf>("exec usp_bqmrmx_hf @blh=@Blh,@tjrq=@Tjrq", param);
            return result;
        }
        public IEnumerable<Xgbb> QueryXG(string zjh,string name)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Zjh", zjh));
            param.Add(new SqlParameter("@Name", name));
            var result = Query<Xgbb>("select top 1 * from VW_HSJG_YIN2 where sfzh=@Zjh and hzxm=@Name order by bgsj desc", param);
            return result;
        }
        public IEnumerable<Xgbb> QueryXGZ(string zjh)
        {
            List<SqlParameter> param = new List<SqlParameter>();
            param.Add(new SqlParameter("@Zjh", zjh));

            string time = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd");
            //param.Add(new SqlParameter("@Time", time));

            var result = Query<Xgbb>("select top 1 * from VW_HSJG_YIN where sfzh=@Zjh  order by bgsj desc", param);
           
            
            return result;
        }
        //public string InsertDyjl()
        //{

        //}

        


    }
}
